package org.codeart.factory.abstract_factory;

import org.codeart.factory.abstract_factory.factory.AbstractFactory;
import org.codeart.factory.abstract_factory.factory.HaierFactory;
import org.codeart.factory.abstract_factory.product.AbstractFridge;
import org.codeart.factory.abstract_factory.product.AbstractTV;

public class Client {

    private AbstractTV abstractTV;

    private AbstractFridge abstractFridge;

    public Client(AbstractFactory abstractFactory) {
        this.abstractTV = abstractFactory.createTV();
        this.abstractFridge = abstractFactory.createFridge();
    }

    public AbstractTV getAbstractTV() {
        return abstractTV;
    }

    public void setAbstractTV(AbstractTV abstractTV) {
        this.abstractTV = abstractTV;
    }

    public AbstractFridge getAbstractFridge() {
        return abstractFridge;
    }

    public void setAbstractFridge(AbstractFridge abstractFridge) {
        this.abstractFridge = abstractFridge;
    }

    public static void main(String[] args) {
        Client client = new Client(new HaierFactory());
        System.out.println(client.getAbstractTV());
        System.out.println(client.getAbstractFridge());
    }

}
